home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1996-01-26 | 2.9 KB | 94 lines |
- ' ********************************************************
- ' *** ***
- ' *** Curve Drawing Procedures ***
- ' *** ***
- ' *** by ***
- ' *** ***
- ' *** Joseph Bolin ***
- ' *** ***
- ' ********************************************************
-
- Dim XP(10),YP(10)
- Screen Open 0,320,200,4,Lowres
- Curs Off : Flash Off : Cls 0
- Palette $0,$FFF,$F00,$B0F
- Ink 1 : _CURVE3[0,100,319,100,160,0,30]
- Ink 2 : _CURVE4[0,100,319,100,160,0,160,199,30]
- For P=1 To 4
- Read XP(P),YP(P) : Ink 1 : Bar XP(P)-1,YP(P)-2 To XP(P)+1,YP(P)+2
- Next
- Ink 3 : _CURVEMANY[4,30]
-
- Data 1,1
- Data 318,1
- Data 1,100
- Data 100,198
-
- Procedure _CURVE3[XB,YB,XE,YE,XC,YC,S]
-
- ' Inputs: XB,YB Beginning coordinate of curve
- ' XE,YE End coordinate of curve
- ' XC,YC Control coordinate
- ' S Number of lines in curve
- '
- ' Output: Draws a 3 point curve on the current screen in the current color
-
- Plot XB,YB
- For ST=0 To S
- X1=XB-((XB-XC)*ST)/S : Y1=YB-((YB-YC)*ST)/S
- X2=XC-((XC-XE)*ST)/S : Y2=YC-((YC-YE)*ST)/S
- X=X1-((X1-X2)*ST)/S : Y=Y1-((Y1-Y2)*ST)/S
- Draw To X,Y
- Next
- End Proc
- Procedure _CURVE4[XB,YB,XE,YE,XC,YC,XT,YT,S]
-
- ' Inputs: XB,YB Beginning coordinate of curve
- ' XE,YE End coordinate of curve
- ' XC,YC Control coordinate
- ' XT,YT Second control coordinate
- ' S Number of lines in curve
- '
- ' Output: Draws a 4 point curve on the current screen in the current color
-
- Plot XB,YB
- For ST=0 To S
- X1=XB+((XC-XB)*ST)/S : Y1=YB+((YC-YB)*ST)/S
- X2=XC+((XT-XC)*ST)/S : Y2=YC+((YT-YC)*ST)/S
- X3=XT+((XE-XT)*ST)/S : Y3=YT+((YE-YT)*ST)/S
- X4=X1+((X2-X1)*ST)/S : Y4=Y1+((Y2-Y1)*ST)/S
- X5=X2+((X3-X2)*ST)/S : Y5=Y2+((Y3-Y2)*ST)/S
- X=X4+((X5-X4)*ST)/S : Y=Y4+((Y5-Y4)*ST)/S
- Draw To X,Y
- Next
- End Proc
- Procedure _CURVEMANY[N,S]
-
- ' Inputs: N Number of points in curve
- ' S Number of lines in curve
- ' XP(),YP() Coordinates of points of the curve
- ' XP(1),YP(1) are the starting coordinates
- ' XP(N),YP(N) are the ending coordinates
- ' the points between 1 and N are the control points
- '
- ' Output: Draws a multiple point curve on the current screen
- ' in the current color
-
- Dim X(N),Y(N)
- Shared XP(),YP()
- Plot XB,YB
- For ST=0 To S
- For P=1 To N
- X(P)=XP(P) : Y(P)=YP(P)
- Next
- L=N
- LP:
- For P=1 To L-1
- X(P)=X(P)+((X(P+1)-X(P))*ST)/S
- Y(P)=Y(P)+((Y(P+1)-Y(P))*ST)/S
- Next
- Dec L : If L>1 Then Goto LP
- SK:
- Draw To X(1),Y(1)
- Next
- End Proc